load("@npm//:prettier/package_json.bzl", prettier = "bin")

# TODO: SERVER-82329 eslint binary should almost exactly mirror prettier binary
# To update prettier change the version in package.json
# Run `pnpm install`
# Commit changes
prettier.prettier_binary(
    name = "prettier",
    # Allow the binary to be run outside bazel
    # See more details about this by commenting this out and running `bazel run //:format`
    env = {"BAZEL_BINDIR": "."},
)

py_binary(
    name = "format",
    srcs = ["format.py"],
    args = [
        "--prettier",
        "$(location :prettier)",
    ],
    data = [":prettier"],
    main = "format.py",
    visibility = ["//visibility:public"],
)
